package entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * Typeb entity.
 *
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "typeb", schema = "public")
public class Typeb implements java.io.Serializable {

    // Fields
    private Integer id;
    private TypeBillet typeBillet;
    private Evenement evenement;
    private Integer prix;
    private Set<Billet> billets = new HashSet<Billet>(0);
    private Integer stock;
    private Integer typeweb;
    // Constructors

    /**
     * default constructor
     */
    public Typeb() {
    }

    /**
     * full constructor
     */
    public Typeb(TypeBillet typeBillet, Evenement evenement, Integer prix,
            Set<Billet> billets) {
        this.typeBillet = typeBillet;
        this.evenement = evenement;
        this.prix = prix;
        this.billets = billets;
    }

    // Property accessors
    @GenericGenerator(name = "generator", strategy = "increment")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return this.id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_type")
    public TypeBillet getTypeBillet() {
        return this.typeBillet;
    }

    public void setTypeBillet(TypeBillet typeBillet) {
        this.typeBillet = typeBillet;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_event")
    public Evenement getEvenement() {
        return this.evenement;
    }

    public void setEvenement(Evenement evenement) {
        this.evenement = evenement;
    }

    @Column(name = "prix")
    public Integer getPrix() {
        return this.prix;
    }

    public void setPrix(Integer prix) {
        this.prix = prix;
    }
  @Column(name = "stock")
    public Integer getStock() {
        return stock;
    }
@Column(name = "typeweb")
    public Integer getTypeweb() {
        return typeweb;
    }

    public void setTypeweb(Integer typeweb) {
        this.typeweb = typeweb;
    }
  
  

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "typeb")
    public Set<Billet> getBillets() {
        return this.billets;
    }

    public void setBillets(Set<Billet> billets) {
        this.billets = billets;
    }
}